package com.zb.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zb.annotation.NumberPattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author WEN
 * @Date 2024/1/12 0012
 **/
@Data
@ApiModel("入库单对象")
public class StoreInboundVo {
    @ApiModelProperty(value = "入库单ID，新增不必传，修改必传")
    private Long id;

    @NotNull(message = "入库类型不能为空")
    @ApiModelProperty(value = "入库类型ID", required = true)
    private Long typeId;

    @NotNull(message = "仓库入库类型不能为空")
    @NumberPattern(regexp = "[0|1|2]", message = "仓库类型参数不合法", required = true)
    @ApiModelProperty(value = "仓库入库类型：0-内部仓库，1-服务商-外部仓库，2-工程师-外部仓库", required = true, example = "0")
    private Integer storeType;

    @NotNull(message = "单据来源不能为空")
    @NumberPattern(regexp = "[1|2|3|4|5]", required = true, message = "单据来源参数不合法")
    @ApiModelProperty(value = "单据来源：1-系统单，2-工单，3-ERP单据，4-仓库移动端单据，5-第三方系统单据", required = true, example = "1")
    private Integer source;

    @ApiModelProperty(value = "预计入库时间")
    private Date estimateTime;

    @Length(max = 500, message = "入库备注长度限制 500 个字符以内")
    @ApiModelProperty(value = "入库备注")
    private String remark;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @ApiModelProperty(value = "单据日期")
    private Date createTime;

    @Length(max = 500, message = "审核备注长度限制 500 个字符以内")
    @ApiModelProperty(value = "审核备注")
    private String reviewRemark;

    @Valid
    @NotNull(message = "入库物料不能为空")
    @NotEmpty(message = "入库物料不能为空")
    @Size(min = 1, message = "入库物料至少要有一条")
    @ApiModelProperty(value = "入库物料对象")
    private List<StoreBoundMaterialVo> inboundMaterialVos;

    @ApiModelProperty(value = "删除的入库物料ID集合")
    private List<Long> delInboundMaterialIds;
}
